package com.meessiom.train.crm.course.repository;
import com.meessiom.train.crm.course.model.Course;
import com.meessiom.train.crm.customer.model.Customer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.sql.Time;
import java.util.List;

@Repository
public interface CourseRepository extends JpaRepository<Course,Long>,JpaSpecificationExecutor {
    @Query(value = "select course_name from customers where id = ?",nativeQuery = true)
    public String getCourseNameByCourseId(long id);



    public List<Course> findByCourseNameLikeAndCourseIntroduceLikeAndCourseCreditAndCourseDateTimeLikeAndCourseTeacher

            (@Param("name") String name ,@Param("introduce") String introduce , @Param("credit") String credit,
            @Param("datetime")Time datatime, @Param("teacher")String teacher);
}
